home *** CD-ROM | disk | FTP | other *** search
- class Stepper
- {
- static var removalStack;
- static var steppables = new ObjectList(true);
- static var paused = false;
- function Stepper()
- {
- }
- static function add(s)
- {
- Stepper.steppables.add(s);
- }
- static function remove(s)
- {
- Stepper.addToRemoveStack(s);
- }
- function stepAll()
- {
- if(!Stepper.paused)
- {
- this.removeAllFromStack();
- var _loc2_ = 0;
- while(_loc2_ < Stepper.steppables.getLength())
- {
- Steppable(Stepper.steppables["get"](_loc2_)).step();
- _loc2_ = _loc2_ + 1;
- }
- }
- }
- static function addToRemoveStack(o)
- {
- if(Stepper.removalStack == null)
- {
- Stepper.removalStack = new Array();
- }
- Stepper.removalStack.push(o);
- }
- function removeAllFromStack()
- {
- var _loc1_ = 0;
- while(_loc1_ < Stepper.removalStack.length)
- {
- Stepper.steppables.remove(Stepper.removalStack[_loc1_]);
- _loc1_ = _loc1_ + 1;
- }
- Stepper.removalStack = null;
- }
- static function pause()
- {
- Stepper.paused = true;
- }
- static function unpause()
- {
- Stepper.paused = false;
- }
- static function isPaused()
- {
- return Stepper.paused;
- }
- function killAll()
- {
- var _loc1_ = 0;
- while(_loc1_ < Stepper.steppables.size())
- {
- Stepper.addToRemoveStack(Stepper.steppables["get"](_loc1_));
- _loc1_ = _loc1_ + 1;
- }
- }
- }
-